<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>particles.js</title>
    <meta name="description" content="particles.js is a lightweight JavaScript library for creating particles.">
    <meta name="author" content="Vincent Garreau" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" media="screen" href="css/style.css">
</head>

<body>

    <!-- count particles -->
    <!-- 左上角框框文字 -->
    <div class="count-particles">
        <span class="js-count-particles">--</span> particles
    </div>

    <!-- particles.js container -->
    <div id="particles-js"></div>

    <!-- scripts -->
    <script src="particles.min.js"></script>
    <script src="js/app.js"></script>

    <!-- stats.js -->
    <!-- 左上角框框 -->
    <script src="js/lib/stats.js"></script>
    <script>
        var count_particles, stats, update;
        stats = new Stats;
        stats.setMode(0);
        stats.domElement.style.position = 'absolute';
        stats.domElement.style.left = '0px';
        stats.domElement.style.top = '0px';
        document.body.appendChild(stats.domElement);
        count_particles = document.querySelector('.js-count-particles');
        update = function() {
            stats.begin();
            stats.end();
            if (window.pJSDom[0].pJS.particles && window.pJSDom[0].pJS.particles.array) {
                count_particles.innerText = window.pJSDom[0].pJS.particles.array.length;
            }
            requestAnimationFrame(update);
        };
        requestAnimationFrame(update);
    </script>

</body>

</html>